%li.user-row
  .user-avatar
    = image_tag avatar_icon(user), class: "avatar", alt: ''
  .user-details
    .user-name
      = link_to user.name, [:admin, user]
    - if user.blocked?
      %span.label.label-danger 禁用
    - if user.admin?
      %span.label.label-success 管理
    - if user.external?
      %span.label.label-default 外部
    - if user == current_user
      %span 自己
    .user-email
      = mail_to user.email, user.email
  .controls
    = link_to '编辑', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: 'btn'
    - unless user == current_user
      .dropdown.inline
        %a.dropdown-new.btn.btn-default#project-settings-button{href: '#', data: { toggle: 'dropdown' } }
          = icon('cog')
          = icon('caret-down')
        %ul.dropdown-menu.dropdown-menu-align-right
          %li.dropdown-header
            设置
            %li
              - if user.ldap_blocked?
                %span.small Cannot unblock LDAP blocked users
              - elsif user.blocked?
                = link_to '启用', unblock_admin_user_path(user), method: :put
              - else
                = link_to '禁用', block_admin_user_path(user), data: { confirm: '用户将被禁用！确定要继续么？' }, method: :put
            - if user.access_locked?
              %li
                = link_to '启用', unlock_admin_user_path(user), method: :put, class: 'btn-grouped btn btn-xs btn-success', data: { confirm: '确认启用该用户？' }
          - if user.can_be_removed?
            %li.divider
            %li
              = link_to '删除用户', [:admin, user], data: { confirm: "用户 #{user.name} 将被删除！所有该用户的相关内容也会被删除！要不要只禁用用户？确定要继续么？" },
                                                   class: 'btn btn-remove btn-block',
                                                   method: :delete
